import { resultPageSuccess, resultSuccess } from "../_util";
import { MockMethod } from "vite-plugin-mock";

function getCollegeList() {
  return [
    {
      collegeId: 1,
      collegeName: "物理学院",
      collegeCode: 401,
      leader: "",
      email: "",
      phone: "",
    },
    {
      collegeId: 2,
      collegeName: "化学学院",
      collegeCode: 402,
      leader: "",
      email: "",
      phone: "",
    },
    {
      collegeId: 3,
      collegeName: "生物学院",
      collegeCode: 403,
      leader: "",
      email: "",
      phone: "",
    },
  ];
}

export default [
  {
    url: "/dev-api/college/page",
    timeout: 100,
    method: "get",
    response: ({ query }) => {
      const { pageNum = 1, pageSize = 10 } = query;
      return resultPageSuccess(pageNum, pageSize, getCollegeList());
    },
  },
  {
    url: "/dev-api/college/selectList",
    timeout: 100,
    method: "get",
    response: () => {
      return resultSuccess(getCollegeList());
    },
  },
  {
    url: "/dev-api/college/save",
    timeout: 100,
    method: "post",
    response: () => {
      return resultSuccess({});
    },
  },
  {
    url: "/dev-api/college/update",
    timeout: 100,
    method: "put",
    response: () => {
      return resultSuccess({});
    },
  },
] as MockMethod[];
